package com.xprime.mobileFramework.file;

import com.adobe.fre.FREContext;
import com.adobe.fre.FREFunction;
import com.adobe.fre.FREInvalidObjectException;
import com.adobe.fre.FREObject;
import com.adobe.fre.FRETypeMismatchException;
import com.adobe.fre.FREWrongThreadException;

public class FileDownLoadExtension implements FREFunction {
	
	@Override
	public FREObject call( FREContext pFREContext, FREObject[] arg1) {
		
		try 
		{
			FileDownLoadAsync fdown = new FileDownLoadAsync();
			fdown.context = pFREContext.getActivity();
			fdown.eventDispatcher = pFREContext;
			fdown.execute( arg1[0].getAsString(), arg1[2].getAsString(), arg1[1].getAsString() );
			
		} catch (IllegalStateException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FRETypeMismatchException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FREInvalidObjectException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (FREWrongThreadException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
	}

}
